<template>
	<view class="main-cont box box-tb box-pack-start box-align-center">
		<view class="top">
			<view class="list box box-align-center box-pack-start mt20">
				<u-input v-model="searchText" type="text" :border="border"
					:custom-style="customStyle" placeholder="搜索专业" />
					<u-image src="@/static/class/icon_search.png" width="34rpx" height="34rpx" @click="goSearch">
						<u-loading slot="loading"></u-loading>
					</u-image>
			</view>
		</view>
		<view class="padd20 school" v-if="page.list.length !=0">
			<view class="items" v-for="(item,index) in list" :key="index" @click="toclass(item)">
				<view class="zymc">
					{{item.zymc}}
				</view>
				<span>({{item.classcnt}})</span>
				
				<u-image src="@/static/home/icon_stu.png" width="29rpx" height="24rpx" style="margin-left: 30px;"></u-image>
				 <span style="color: #9697ba;margin-left: 4px;">{{item.stucnt}}</span>
			</view>
		</view>
		<no-data title="暂无数据" v-else class="nodata"></no-data>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				currSchool:uni.getStorageSync('currSchool'),
				searchText:'',
				customStyle: {
					width:"560rpx",
					padding: "40rpx",
					color: "#000"
				},
                list: []
			}
		},
		onShow() {
			this.goSearch();
		},
		methods: {
			goSearch() {
				this.$api.post({url: '/dzy/zylist'}, {schoolid:this.currSchool.id,searchtext:this.searchText}).then(res => {
					//console.log(res.list);
					if(res.code==0){
						this.list = res.list;
					}
				})
			},
			goIndex(data) {
				uni.navigateTo({ url:'/team/tr/selectZy' })
			},
			toclass(item){
				wx.vibrateShort();
				uni.navigateTo({url:"/team/bj/main?zydm="+item.zydm+"&zymc="+item.zymc})
			}
		}
	}
</script>

<style scoped lang='scss'>
	.main-cont {
		width: 100%;
		height: 100%;
		overflow-y: auto;
		
	}
	
	.zymc{
		width: 460rpx;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}
	
	.top {
		width: 100%;
		background-color: #fff;
		padding-bottom: 25rpx;
	}
	.list {
		margin: 20rpx auto 0;
		width: 710rpx;
		height: 86rpx;
		background: #F3F4FB;
		border-radius: 43rpx;
	}
	.school {
		width: 100%;
		height: 500px;
		overflow-y: scroll;
	}
	.items {
		display: flex;
		box-sizing: border-box;
		padding: 0 40rpx;
		margin-bottom: 24rpx;
		color: #2F3142;
		font-size: 30rpx;
		text-align: left;
		height: 116rpx;
		line-height: 116rpx;
		background: #FFFFFF;
		box-shadow: 0px 23rpx 46rpx 0px rgba(205, 207, 230, 0.18);
		border-radius: 30rpx;
	}
</style>

